package me.winds.foundation;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import me.winds.widget.usage.TitleView;
import me.winds.wrapper.base.presenter.BaseMvpPresenter;
import me.winds.wrapper.base.view.WrapperMvpActivity;
import me.winds.wrapper.core.model.BaseVo;
import me.winds.wrapper.core.network.ResponseInfo;
import me.winds.wrapper.utils.LogUtils;

/**
 * Author:  winds
 * Email:   heardown@163.com
 * Date:    2019/5/26.
 * Desc:
 */
public class MvpActivity extends WrapperMvpActivity<BaseMvpPresenter> {

    @Override
    protected int getViewLayout() {
        return R.layout.activity_mvp;
    }

    @Override
    protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
        titleView.setTitle("Mvp");
    }

    @Override
    protected void loadData(Bundle savedInstanceState, Intent intent) {

    }

    @Override
    public void onLoadSuccess(String url, BaseVo dataVo) {
        LogUtils.i(url, dataVo.toString());
    }

    @Override
    public void onLoadError(ResponseInfo responseInfo) {
        super.onLoadError(responseInfo);
        LogUtils.i("  " + responseInfo.getUrl() + " ", responseInfo.rawData.toString());
    }

    public void click(View view) {
        presenter.postData(true, "http://123.56.221.77/musicApi/toplist/detail", null, null, BaseVo.class);
    }
}
